﻿using black_screen_mode_server.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace black_screen_mode_server.DataCommunication
{
    public class GroupResponseData:IPacketData
    {
        public List<GroupInfoModel> GroupInfos { get; set; } 
        public GroupResponseData()
        {
            this.GroupInfos = new List<GroupInfoModel>();
        }
        public void JsonToPacket(string jsonData)
        {
            var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<GroupResponseData>(jsonData);
            this.GroupInfos = obj.GroupInfos;
        }

        public string PacketToJson()
        {
            //对象转json
            return Newtonsoft.Json.JsonConvert.SerializeObject(this);
        }
    }
}
